package com.dtsz.m2.utils;

import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;

public class DateUtils {
    /**
     * 最佳时间
     *
     * @param type
     * @param hour
     * @return
     */
    public static String getAdditionalDate(Long timeLong, int type, int hour) {
        Date date = new Date(timeLong);//取时间
        Calendar calendar = new GregorianCalendar();
        calendar.setTime(date);
        switch (type) {
            case Calendar.HOUR:
                calendar.add(Calendar.HOUR, hour);//日期推演N个小时
                break;
            case Calendar.MINUTE:
                calendar.add(Calendar.MINUTE, hour);//日期推演N个小时
                break;
        }
        date = calendar.getTime();
        return date.getTime() + "";
    }
}
